//
//  AboutMySelfViewController.m
//  RENTVISITOR
//
//  Created by wonder on 2017/8/22.
//  Copyright © 2017年 UNN. All rights reserved.
//

#import "AboutMySelfViewController.h"
#import "RentVieitor.h"

@interface AboutMySelfViewController ()

@end

@implementation AboutMySelfViewController


- (void)viewWillAppear:(BOOL)animated {
    self.tabBarController.tabBar.hidden = YES;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"关于我们";
    self.view.backgroundColor = [UIColor whiteColor];
    [self creatLeftView];
    [self creatView];
}

- (void)creatLeftView {
    
    // 自定义导航栏左侧按钮
    UIButton * leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    leftBtn.frame = CGRectMake(0, 0, 10,15 );
    [leftBtn setBackgroundImage:[UIImage imageNamed:@"箭头左"] forState:UIControlStateNormal];
    [leftBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem * leftItem = [[UIBarButtonItem alloc] initWithCustomView:leftBtn];
    self.navigationItem.leftBarButtonItem = leftItem;
    
}

- (void)creatView {
    
    UIImageView *logoView = [[UIImageView alloc] initWithFrame:CGRectMake((KWidth-85)/2, 160-64, 85, 85)];
    logoView.image = [UIImage imageNamed:@"logo-iccon"];
    [self.view addSubview:logoView];
    
    //租客网
    UIImageView *imgView =  [[UIImageView alloc] initWithFrame:CGRectMake((KWidth-90)/2, 260-64, 90, 30)];
    imgView.image = [UIImage imageNamed:@"租客网"];
    [self.view addSubview:imgView];
    
    UILabel *selectLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 300-64, KWidth-40, 30)];
    selectLabel.text = @"好生活,租着过";
    selectLabel.font = [UIFont systemFontOfSize:17];
    selectLabel.textAlignment = NSTextAlignmentCenter;
    selectLabel.textColor = [Utils colorConvertFromString:@"#333333"];
    [self.view addSubview:selectLabel];
    
    //分割线
    CALayer *MlineLayer7 = [CALayer layer];
    MlineLayer7.backgroundColor = [[Utils colorConvertFromString:@"#d0d0d0"] CGColor];
    MlineLayer7.frame = CGRectMake(0 ,380-64, KWidth, 1);
    [self.view.layer addSublayer:MlineLayer7];

    UILabel *contentLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 410-64,KWidth-40 ,50)];
    contentLabel.text = @"租客APP是租客网官方手机客户端,为租房者提供房源信息搜索,浏览功能,为业主提供在线委托及在售房源管理功能,让你的房产交易更加便捷.";
    contentLabel.textColor = [Utils colorConvertFromString:@"#333333"];
    contentLabel.font = [UIFont systemFontOfSize:13];
    contentLabel.numberOfLines = 0;
    [self changeLineSpaceForLabel:contentLabel WithSpace:5.0];
    [self.view addSubview:contentLabel];
    
    UILabel *OfficialLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 470-50, KWidth-40,20)];
    OfficialLabel.text = @"官方网站:  www.zuke.com";
    OfficialLabel.font = [UIFont systemFontOfSize:13];
    OfficialLabel.textAlignment = NSTextAlignmentLeft;
    OfficialLabel.textColor = [Utils colorConvertFromString:@"#333333"];
    [self.view addSubview:OfficialLabel];
    
    UILabel *tellLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 490-50, KWidth-40,20)];
    tellLabel.text = @"客服电话:  4006-222222";
    tellLabel.font = [UIFont systemFontOfSize:13];
    tellLabel.textAlignment = NSTextAlignmentLeft;
    tellLabel.textColor = [Utils colorConvertFromString:@"#333333"];
    [self.view addSubview:tellLabel];
    
    //分割线
    CALayer *MlineLayer2 = [CALayer layer];
    MlineLayer2.backgroundColor = [[Utils colorConvertFromString:@"#d0d0d0"] CGColor];
    MlineLayer2.frame = CGRectMake(0 ,530, KWidth, 1);
    [self.view.layer addSublayer:MlineLayer2];
    
    UILabel *vesLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 550, KWidth-40,20)];
    NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
    NSString *app_Version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
    vesLabel.text = [NSString stringWithFormat:@"版本号: %@",app_Version];
    vesLabel.font = [UIFont systemFontOfSize:13];
    vesLabel.textAlignment = NSTextAlignmentCenter;
    vesLabel.textColor = [Utils colorConvertFromString:@"#333333"];
    [self.view addSubview:vesLabel];
}

//改变行间距
- (void)changeLineSpaceForLabel:(UILabel *)label WithSpace:(float)space {
    
    NSString *labelText = label.text;
    NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:labelText];
    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
    [paragraphStyle setLineSpacing:space];
    [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [labelText length])];
    label.attributedText = attributedString;
    [label sizeToFit];
    
}


- (void)backAction {
    
    [self.navigationController popViewControllerAnimated:YES];
}
@end
